package com.sc.everyonerentboot.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sc.everyonerentboot.mapper.OrdersMapper;
import com.sc.everyonerentboot.pojo.Orders;
import com.sc.everyonerentboot.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    OrdersMapper mapper;
    @Override
    public int add(Orders o) {
        return mapper.insertSelective(o);
    }

    @Override
    public int del(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int update(Orders o) {
        return mapper.updateByPrimaryKeySelective(o);
    }

    @Override
    public Orders selById(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo<Orders> selAll(Integer pageNum, Integer pageSize, Orders o) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(mapper.selAll(o));
    }

    @Override
    public int delAll(Integer[] ids) {
        return mapper.delAll(ids);
    }
}
